package com.atguigu.clients;

import com.atguigu.param.ProductIdsParam;
import com.atguigu.param.ProductSaveParam;
import com.atguigu.param.ProductSearchParam;
import com.atguigu.pojo.Product;
import com.atguigu.utils.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

@FeignClient("product-service")
public interface ProductClient {

    @GetMapping("product/list")
    public List<Product> list();

    @PostMapping("product/ids")
    public R ids(@RequestBody ProductIdsParam productIdsParam);

    @GetMapping("product/id/{product_id}")
    public Product id(@PathVariable("product_id") Integer productId);

    @PostMapping("product/count")
    public Long count(@RequestBody Integer categoryId);

    @PostMapping("product/search")
    public R search(@RequestBody ProductSearchParam productSearchParam);


    @PostMapping("product/save")
    public R save(@RequestBody ProductSaveParam productSaveParam);


    @PostMapping("product/update")
    public R update(@RequestBody Product product);

    @PostMapping("product/remove")
    public R remove(@RequestBody Integer productId);
}

